#if (FEATURE_MODE == 0)
/**
 @file ctc_monitor_cli.c

 @date 2010-4-1

 @version v2.0
*/

#include "ctc_api.h"
#include "ctcs_api.h"
#include "ctc_cli.h"
#include "ctc_cli_common.h"
#include "ctc_debug.h"
#include "ctc_monitor_cli.h"
#define CTC_MONITOR_BUFFER_GLOBAL_TYPE_STR "total|c2c|control|sc SC_ID|round-trip|span"
#define CTC_MONITOR_BUFFER_GLOBAL_TYPE_DESC \
    "Total buffer type",\
    "C2C buffer type",\
    "Control buffer type",\
    "Sc buffer type",\
    "Sc value",\
    "Round trip buffer type",\
    "Span buffer type"

#define CTC_MONITOR_BUFFER_TYPE_ALL_STR \
    "(port GPORT_ID (port-sc SC|port-prio-class PRIO_CLASS (prio-class-lvl LEVEL|)|queue|) | "CTC_MONITOR_BUFFER_GLOBAL_TYPE_STR")"
    
#define CTC_MONITOR_BUFFER_TYPE_ALL_DESC \
    CTC_CLI_GPORT_DESC,\
    CTC_CLI_GPORT_ID_DESC,\
    "PortSc buffer type",\
    "Sc value",\
    "Port prio class buffer type",\
    "Prio class value",\
    "Prio class level",\
    "Prio class level value",\
    "Queue buffer type",\
    CTC_MONITOR_BUFFER_GLOBAL_TYPE_DESC

#define CTC_CLI_MONITOR_QUEUE_WATERMARK_NUM_MAX 32

int32  _ctc_cli_monitor_buffer_type_parser(ctc_vti_t* vty, uint8 *buffer_type, char** argv, uint16 argc)
{
    uint8 index = 0xFF;

    *buffer_type = CTC_MONITOR_BUFFER_SPAN + 1;
    index = CTC_CLI_GET_ARGC_INDEX("port");
    if (0xFF != index)
    {
        /* port type */
        *buffer_type = CTC_MONITOR_BUFFER_PORT;
    }
    /* queue type */
    index = CTC_CLI_GET_ARGC_INDEX("queue");
    if (0xFF != index)
    {
        *buffer_type = CTC_MONITOR_BUFFER_QUEUE;
    }
    /* total type */
    index = CTC_CLI_GET_ARGC_INDEX("total");
    if (0xFF != index)
    {
        *buffer_type = CTC_MONITOR_BUFFER_TOTAL;
    }
    /* c2c type */
    index = CTC_CLI_GET_ARGC_INDEX("c2c");
    if (0xFF != index)
    {
        *buffer_type = CTC_MONITOR_BUFFER_C2C;
    }
    /* control type */
    index = CTC_CLI_GET_ARGC_INDEX("control");
    if (0xFF != index)
    {
        *buffer_type = CTC_MONITOR_BUFFER_CONTROL;
    }
    /* sc type */
    index = CTC_CLI_GET_ARGC_INDEX("sc");
    if (0xFF != index)
    {
        *buffer_type = CTC_MONITOR_BUFFER_SC;
    }
    /* round-trip type */
    index = CTC_CLI_GET_ARGC_INDEX("round-trip");
    if (0xFF != index)
    {
        *buffer_type = CTC_MONITOR_BUFFER_ROUND_TRIP;
    }
    /* span type */
    index = CTC_CLI_GET_ARGC_INDEX("span");
    if (0xFF != index)
    {
        *buffer_type = CTC_MONITOR_BUFFER_SPAN;
    }
    /* port-sc type */
    index = CTC_CLI_GET_ARGC_INDEX("port-sc");
    if (0xFF != index)
    {
        *buffer_type = CTC_MONITOR_BUFFER_PORT_SC;
    }
    /* port prio class type */
    index = CTC_CLI_GET_ARGC_INDEX("port-prio-class");
    if (0xFF != index)
    {
        *buffer_type = CTC_MONITOR_BUFFER_PORT_PRIO_CLASS;
    }

    return (*buffer_type == CTC_MONITOR_BUFFER_SPAN + 1) ? CLI_ERROR : CLI_SUCCESS;
}


CTC_CLI(ctc_cli_monitor_set_buffer_monitor,
        ctc_cli_monitor_set_monitor_buffer_cmd,
        "monitor buffer "CTC_MONITOR_BUFFER_TYPE_ALL_STR" (inform|log) (enable|disable)",
        CTC_CLI_MONITOR_M_STR,
        "Buffer Monitor",
        CTC_MONITOR_BUFFER_TYPE_ALL_DESC,
        "Inform and generate event",
        "Log to cpu",
        "Enable",
        "Disable")
{
    int32 ret = 0;
    uint8 index = 0;
    uint8 sc = 0;
    uint8 level = 0;
    uint32 gport = 0;
    ctc_monitor_config_t config;
    sal_memset(&config, 0, sizeof(config));

    config.monitor_type = CTC_MONITOR_BUFFER;

    ret = _ctc_cli_monitor_buffer_type_parser(vty, &config.buffer_type, &argv[0], argc);

    index = CTC_CLI_GET_ARGC_INDEX("port");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("gport", gport, argv[index + 1]);
        config.gport = gport;
    }

    index = CTC_CLI_GET_ARGC_INDEX("sc");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("sc", sc, argv[index + 1]);
        config.sc = sc;
    }

    index = CTC_CLI_GET_ARGC_INDEX("port-sc");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("port-sc", sc, argv[index + 1]);
        config.sc = sc;
    }

    index = CTC_CLI_GET_ARGC_INDEX("port-prio-class");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("port-prio-class", sc, argv[index + 1]);
        config.sc = sc;
        index = CTC_CLI_GET_ARGC_INDEX("prio-class-lvl");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("prio-class-lvl", level, argv[index + 1]);
            config.level = level;
        }
    }
    
    index = CTC_CLI_GET_ARGC_INDEX("log");
    if (0xFF != index)
    {
        config.cfg_type = CTC_MONITOR_CONFIG_LOG_EN;
    }

    index = CTC_CLI_GET_ARGC_INDEX("enable");
    if (0xFF != index)
    {
        config.value = 1;
    }

    if(g_ctcs_api_en)
    {
        ret = ctcs_monitor_set_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_set_config(&config);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_monitor_set_buffer_scan,
        ctc_cli_monitor_set_buffer_scan_cmd,
        "monitor buffer "CTC_MONITOR_BUFFER_TYPE_ALL_STR" "CTC_CLI_DIR_STR" scan (enable|disable)",
        CTC_CLI_MONITOR_M_STR,
        "Buffer Monitor",
        CTC_MONITOR_BUFFER_TYPE_ALL_DESC,
        CTC_CLI_DIR_DESC,
        "Scan and generate stats",
        "Enable",
        "Disable")
{
    int32 ret = 0;
    uint32 gport = 0;
    uint8 index = 0;
    uint8 sc = 0;
    ctc_monitor_config_t config;
    sal_memset(&config, 0, sizeof(config));

    config.monitor_type = CTC_MONITOR_BUFFER;

    config.cfg_type = CTC_MONITOR_CONFIG_MON_SCAN_EN;
    
    ret = _ctc_cli_monitor_buffer_type_parser(vty, &config.buffer_type, &argv[0], argc);

    index = CTC_CLI_GET_ARGC_INDEX("port");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("gport", gport, argv[index + 1]);
        config.gport = gport;
    }

    index = CTC_CLI_GET_ARGC_INDEX("sc");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("sc", sc, argv[index + 1]);
        config.sc = sc;
    }

    CTC_CLI_DIR_SET(&config.dir);
    
    index = CTC_CLI_GET_ARGC_INDEX("enable");
    if (0xFF != index)
    {
        config.value = 1;
    }

    if(g_ctcs_api_en)
    {
        ret = ctcs_monitor_set_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_set_config(&config);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}



CTC_CLI(ctc_cli_monitor_set_latency_monitor,
        ctc_cli_monitor_set_monitor_latency_cmd,
        "monitor latency ((port GPORT_ID) (inform|log|discard|scan|ecn-mark) \
        |path-port (src-port SRC_GPORT|) (dst-port DST_GPORT|)) \
        (enable|disable)",
        CTC_CLI_MONITOR_M_STR,
        "Latency Monitor",
        CTC_CLI_GPORT_DESC,
        CTC_CLI_GPHYPORT_ID_DESC,
        "Inform and generate event",
        "Log to cpu",
        "Discard",
        "Scan and generate stats",
        "ECN mark",
        "monitor port path",
        "source global port",
        CTC_CLI_GPHYPORT_ID_DESC,
        "Destination global port",
        CTC_CLI_GPHYPORT_ID_DESC,
        "Enable",
        "Disable")
{
    int32 ret = 0;
    uint8 index = 0;
    uint32 gport = 0;
    ctc_monitor_config_t config;
    sal_memset(&config, 0, sizeof(config));

    config.monitor_type = CTC_MONITOR_LATENCY;

    index = CTC_CLI_GET_ARGC_INDEX("port");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("gport", gport, argv[index + 1]);
        config.gport = gport;
    }

    index = CTC_CLI_GET_ARGC_INDEX("inform");
    if (0xFF != index)
    {
        config.cfg_type = CTC_MONITOR_CONFIG_MON_INFORM_EN;
    }


    index = CTC_CLI_GET_ARGC_INDEX("scan");
    if (0xFF != index)
    {
        config.cfg_type = CTC_MONITOR_CONFIG_MON_SCAN_EN;
    }


    index = CTC_CLI_GET_ARGC_INDEX("log");
    if (0xFF != index)
    {
        config.cfg_type = CTC_MONITOR_CONFIG_LOG_EN;
    }

    index = CTC_CLI_GET_ARGC_INDEX("discard");
    if (0xFF != index)
    {
        config.cfg_type = CTC_MONITOR_CONFIG_LANTENCY_DISCARD_EN;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ecn-mark");
    if (0xFF != index)
    {
        config.cfg_type = CTC_MONITOR_CONFIG_LANTENCY_ECN_EN;
    }
    index = CTC_CLI_GET_ARGC_INDEX("path-port");
    if (0xFF != index)
    {
        config.cfg_type = CTC_MONITOR_CONFIG_PATH_LANTENCY_EN;
    }

    index = CTC_CLI_GET_ARGC_INDEX("src-port");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("src gport", gport, argv[index + 1]);
        config.src_gport = gport;
    }

    index = CTC_CLI_GET_ARGC_INDEX("dst-port");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("dst gport", gport, argv[index + 1]);
        config.gport = gport;
    }

    index = CTC_CLI_GET_ARGC_INDEX("enable");
    if (0xFF != index)
    {
        config.value = 1;
    }

    if(g_ctcs_api_en)
    {
        ret = ctcs_monitor_set_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_set_config(&config);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_monitor_set_timer,
        ctc_cli_monitor_set_timer_cmd,
        "monitor (buffer|latency) (scan-interval TIMER)",
        CTC_CLI_MONITOR_M_STR,
        "Buffer Monitor",
        "Latency Monitor",
         "Scan interval",
         "Value <ms>")
{
    int32 ret = 0;
    uint8 index = 0;
    uint32 interval = 0;
    ctc_monitor_config_t config;
    sal_memset(&config, 0, sizeof(config));

    index = CTC_CLI_GET_ARGC_INDEX("buffer");
    if (0xFF != index)
    {
        config.monitor_type = CTC_MONITOR_BUFFER;
    }
    else
    {
        config.monitor_type = CTC_MONITOR_LATENCY;
    }

    index = CTC_CLI_GET_ARGC_INDEX("scan-interval");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("scan interval", interval, argv[index + 1]);
        config.value = interval;
    }

    config.cfg_type = CTC_MONITOR_CONFIG_MON_INTERVAL;

    if(g_ctcs_api_en)
    {
        ret = ctcs_monitor_set_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_set_config(&config);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }


    return ret;
}

CTC_CLI(ctc_cli_monitor_get_timer,
        ctc_cli_monitor_get_timer_cmd,
        "show monitor (buffer|latency) scan-interval",
        "Show",
        CTC_CLI_MONITOR_M_STR,
        "Buffer Monitor",
        "Latency Monitor",
        "Scan interval")
{
    int32 ret = 0;
    uint8 index = 0;
    ctc_monitor_config_t config;
    sal_memset(&config, 0, sizeof(config));

    index = CTC_CLI_GET_ARGC_INDEX("buffer");
    if (0xFF != index)
    {
        config.monitor_type = CTC_MONITOR_BUFFER;
    }
    else
    {
        config.monitor_type = CTC_MONITOR_LATENCY;
    }

    config.cfg_type = CTC_MONITOR_CONFIG_MON_INTERVAL;

    if(g_ctcs_api_en)
    {
        ret = ctcs_monitor_get_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_get_config(&config);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    ctc_cli_out("%-19s : %-8u\n", "scan-interval", config.value);
    return CLI_SUCCESS;
}
#define g_queue_cnt     (CTC_VTY_CLIENT(vty)->qos_queue_cnt)
#define g_queue         ((ctc_qos_queue_id_t*)CTC_VTY_CLIENT(vty)->qos_queue)
CTC_CLI(ctc_cli_monitor_queue_watermark_en,
        ctc_cli_monitor_queue_watermark_en_cmd,
        "monitor buffer queue (" CTC_CLI_QOS_QUEUE_ID_STR "|) watermark-en (end|)",
        CTC_CLI_MONITOR_M_STR,
        "Buffer Monitor",
        "Queue",
        CTC_CLI_QOS_QUEUE_ID_DSCP,
        "Watermark enable",
        "End")
{
    uint8 is_end = 0;
    uint8 is_qvalid = 0;
    uint8 index = 0;
    int32 ret = 0;
    ctc_monitor_glb_cfg_t config;

    sal_memset(&config, 0, sizeof(config));

    if (!CTC_VTY_CLIENT(vty)->qos_queue)
    {
        CTC_VTY_CLIENT(vty)->qos_queue = mem_malloc(MEM_CLI_MODULE, sizeof(ctc_qos_queue_id_t)*CTC_CLI_MONITOR_QUEUE_WATERMARK_NUM_MAX);
        if (!CTC_VTY_CLIENT(vty)->qos_queue)    { return CLI_ERROR; }
        sal_memset(CTC_VTY_CLIENT(vty)->qos_queue, 0, sizeof(ctc_qos_queue_id_t)*CTC_CLI_MONITOR_QUEUE_WATERMARK_NUM_MAX);
    }
    sal_memset(&g_queue[g_queue_cnt], 0, sizeof(ctc_qos_queue_id_t));
    
    CTC_CLI_QOS_QUEUE_SET(&g_queue[g_queue_cnt]);

    if(is_qvalid)
    {
       g_queue_cnt++;
    }

    index = CTC_CLI_GET_ARGC_INDEX("end");
    if (0xFF != index)
    {
        is_end = 1;
    }

    if (is_end)
    {
        config.cfg_type = CTC_MONITOR_GLB_CONFIG_QWM_EN;
        config.u.qwm.queue_cnt = g_queue_cnt;
        config.u.qwm.queue_list = g_queue;
        if(g_ctcs_api_en)
        {
            ret = ctcs_monitor_set_global_config(g_api_ldev, &config);
        }
        else
        {
            ret = ctc_monitor_set_global_config(&config);
        }

        sal_memset(g_queue, 0, sizeof(ctc_qos_queue_id_t)*CTC_CLI_MONITOR_QUEUE_WATERMARK_NUM_MAX);
        g_queue_cnt = 0;
        if (ret < 0)
        {
            ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
    }
    else
    {
        if (g_queue_cnt > CTC_CLI_MONITOR_QUEUE_WATERMARK_NUM_MAX || !is_qvalid)
        {
            sal_memset(g_queue, 0, sizeof(ctc_qos_queue_id_t)*CTC_CLI_MONITOR_QUEUE_WATERMARK_NUM_MAX);
            g_queue_cnt = 0;
            ret = CTC_E_INVALID_PARAM;
            ctc_cli_out("%% ret = %d, %s\n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
    }
    return ret;
}

CTC_CLI(ctc_cli_monitor_show_queue_watermark_en,
        ctc_cli_monitor_show_queue_watermark_en_cmd,
        "show monitor buffer queue watermark-en",
        "Show",
        CTC_CLI_MONITOR_M_STR,
        "Buffer Monitor",
        "Queue",
        "Watermark enable")
{
    uint8 index = 0;
    int32 ret = 0;
    ctc_monitor_glb_cfg_t config;

    sal_memset(&config, 0, sizeof(config));
    config.cfg_type = CTC_MONITOR_GLB_CONFIG_QWM_EN;
    config.u.qwm.queue_cnt = CTC_CLI_MONITOR_QUEUE_WATERMARK_NUM_MAX;

    config.u.qwm.queue_list = (ctc_qos_queue_id_t *)mem_malloc(MEM_CLI_MODULE, sizeof(ctc_qos_queue_id_t) * CTC_CLI_MONITOR_QUEUE_WATERMARK_NUM_MAX);
    if (NULL == config.u.qwm.queue_list)
    {
        return CLI_ERROR;
    }
    sal_memset(config.u.qwm.queue_list, 0, sizeof(ctc_qos_queue_id_t) * CTC_CLI_MONITOR_QUEUE_WATERMARK_NUM_MAX);
    if(g_ctcs_api_en)
    {
        ret = ctcs_monitor_get_global_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_get_global_config(&config);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    ctc_cli_out("%-6s %-10s %-10s %-10s %-10s %-10s\n", "NO.", "Type","Port","Service-Id","Reason","QueID");
    ctc_cli_out("-----------------------------------\n");
    for(index = 0; index < config.u.qwm.queue_cnt; index++)
    {
        ctc_cli_out("%-6d %-10d %-10d %-10d %-10d %-10d\n", index, config.u.qwm.queue_list[index].queue_type, config.u.qwm.queue_list[index].gport,
            config.u.qwm.queue_list[index].service_id, config.u.qwm.queue_list[index].cpu_reason, config.u.qwm.queue_list[index].queue_id);
    }
    return ret;
}

CTC_CLI(ctc_cli_monitor_queue_watermark,
        ctc_cli_monitor_queue_watermark_cmd,
        "(show|clear) monitor buffer queue direction egress"CTC_CLI_QOS_QUEUE_ID_STR" watermark",
        "Show",
        "Clear",
        CTC_CLI_MONITOR_M_STR,
        "Buffer Monitor",
        "Queue",
        "Flow direction",
        "Egress",
        CTC_CLI_QOS_QUEUE_ID_DSCP,
        "Watermark")
{
    int32 ret = 0;
    ctc_monitor_watermark_t watermark;
    uint8 index = 0;
    uint8 is_qvalid = 0;
    bool  clear_op = 0;
    sal_memset(&watermark, 0, sizeof(watermark));

    watermark.monitor_type = CTC_MONITOR_BUFFER;
    watermark.u.buffer.buffer_type = CTC_MONITOR_BUFFER_QUEUE;
    watermark.u.buffer.dir = CTC_EGRESS;

    index = CTC_CLI_GET_ARGC_INDEX("clear");
    if (0xFF != index)
    {
         clear_op = TRUE;
    }

    CTC_CLI_QOS_QUEUE_SET(&watermark.queue);

    if (clear_op == 0)
    {
        if(g_ctcs_api_en)
        {
             ret = ctcs_monitor_get_watermark(g_api_ldev, &watermark);
        }
        else
        {
            ret = ctc_monitor_get_watermark(&watermark);
        }
        if (ret < 0)
        {
            ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }

        ctc_cli_out("Max TotoalCnt:%d\n",is_qvalid ? watermark.u.buffer.max_total_cnt : 0);
    }
    else
    {
        if (g_ctcs_api_en)
        {
             ret = ctcs_monitor_clear_watermark(g_api_ldev, &watermark);
        }
        else
        {
            ret = ctc_monitor_clear_watermark(&watermark);
        }
        if (ret < 0)
        {
            ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
    }

return ret;
}

CTC_CLI(ctc_cli_monitor_op_watermark,
        ctc_cli_monitor_op_watermark_cmd,
        "(show|clear) monitor ((buffer "CTC_CLI_DIR_STR")("CTC_MONITOR_BUFFER_TYPE_ALL_STR"|(queue "CTC_CLI_QOS_QUEUE_ID_STR"))\
        |latency (port GPORT_ID|src-port SRC_GPORT (dst-port DST_GPORT|))(queue-id QUEUE_ID|)(class-prio CLASS_PRIO|)) watermark ("CTC_CLI_PP_ID_STR" |)",
        "Show",
        "Clear",
        CTC_CLI_MONITOR_M_STR,
        "Buffer Monitor",
        CTC_CLI_DIR_DESC,
        CTC_MONITOR_BUFFER_TYPE_ALL_DESC,
        "Queue type",
        CTC_CLI_QOS_QUEUE_ID_DSCP,
        "Latency Monitor",
        CTC_CLI_GPORT_DESC,
        CTC_CLI_GPHYPORT_ID_DESC,
        "Source port",
        CTC_CLI_GPHYPORT_ID_DESC,
        "Destination port",
        CTC_CLI_GPHYPORT_ID_DESC,
        "Queue id",
        CTC_CLI_QOS_QUEUE_VAL,
        "Class prioity",
        "Class prioity value",
        "Watermark",
        CTC_CLI_PP_ID_DESC)
{
    int32 ret = 0;
    ctc_monitor_watermark_t watermark;
    uint8 index = 0;
    uint32 gport = 0;
    uint16 value = 0;
    bool  clear_op = 0;
    uint8 is_qvalid = 0;
    uint8 sc = 0;
    sal_memset(&watermark, 0, sizeof(watermark));

    index = CTC_CLI_GET_ARGC_INDEX("clear");
    if (0xFF != index)
    {
         clear_op = TRUE;
    }

    index = CTC_CLI_GET_ARGC_INDEX("buffer");
    if (0xFF != index)
    {
        watermark.monitor_type = CTC_MONITOR_BUFFER;
        ret = _ctc_cli_monitor_buffer_type_parser(vty, &watermark.u.buffer.buffer_type, &argv[0], argc);

        CTC_CLI_DIR_SET(&watermark.u.buffer.dir);

        index = CTC_CLI_GET_ARGC_INDEX("port");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT32("gport", gport, argv[index + 1]);
            watermark.gport = gport;
        }

        index = CTC_CLI_GET_ARGC_INDEX("sc");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("sc", sc, argv[index + 1]);
            watermark.u.buffer.sc = sc;
        }

        index = CTC_CLI_GET_ARGC_INDEX("port-sc");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("port-sc", sc, argv[index + 1]);
            watermark.u.buffer.sc = sc;
        }

        index = CTC_CLI_GET_ARGC_INDEX("port-prio-class");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("port-prio-class", sc, argv[index + 1]);
            watermark.u.buffer.sc = sc;
        }

        if (CTC_MONITOR_BUFFER_QUEUE == watermark.u.buffer.buffer_type || is_qvalid)
        {
            CTC_CLI_QOS_QUEUE_SET(&watermark.queue);
            is_qvalid = 1;
        }
    }
    else
    {
        watermark.monitor_type = CTC_MONITOR_LATENCY;
        index = CTC_CLI_GET_ARGC_INDEX("port");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT32("gport", gport, argv[index + 1]);
            watermark.gport = gport;
        }
        index = CTC_CLI_GET_ARGC_INDEX("src-port");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT32("src gport", gport, argv[index + 1]);
            watermark.src_gport = gport;
        }

        index = CTC_CLI_GET_ARGC_INDEX("dst-port");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT32("dst gport", gport, argv[index + 1]);
            watermark.gport = gport;
        }

        index = CTC_CLI_GET_ARGC_INDEX("queue-id");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT16("queue id", value, argv[index + 1]);
            watermark.queue.queue_id = value;
        }

        index = CTC_CLI_GET_ARGC_INDEX("class-prio");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT16("class prio", value, argv[index + 1]);
            watermark.queue.class_prio = value;
        }
    }

    index = CTC_CLI_GET_ARGC_INDEX("pp-id");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT8("pp-id", watermark.u.buffer.pp_id, argv[index+1]);
    }

    if (clear_op == 0)
    {
        if(g_ctcs_api_en)
        {
             ret = ctcs_monitor_get_watermark(g_api_ldev, &watermark);
        }
        else
        {
            ret = ctc_monitor_get_watermark(&watermark);
        }
        if (ret < 0)
        {
            ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }

        if (watermark.monitor_type == CTC_MONITOR_LATENCY)
        {
            ctc_cli_out("Max Latency:%"PRIu64"ns\n", watermark.u.latency.max_latency);
            ctc_cli_out("Min Latency:%"PRIu64"ns\n", watermark.u.latency.min_latency);
        }
        else if(watermark.u.buffer.dir == CTC_EGRESS)
        {
            if(watermark.u.buffer.buffer_type == CTC_MONITOR_BUFFER_PORT)
            {
                ctc_cli_out("Max UcCnt:%d, McCnt:%d, TotoalCnt:%d\n",
                            watermark.u.buffer.max_uc_cnt,
                            watermark.u.buffer.max_mc_cnt,
                            watermark.u.buffer.max_total_cnt);
            }
            else
            {
                ctc_cli_out("Max TotoalCnt:%d\n",watermark.u.buffer.max_total_cnt);
            }
        }
        else if(watermark.u.buffer.dir == CTC_INGRESS)
        {
            ctc_cli_out("Max TotoalCnt:%d\n", watermark.u.buffer.max_total_cnt);
        }
    }
    else
    {
        if (g_ctcs_api_en)
        {
             ret = ctcs_monitor_clear_watermark(g_api_ldev, &watermark);
        }
        else
        {
            ret = ctc_monitor_clear_watermark(&watermark);
        }
        if (ret < 0)
        {
            ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
    }

return ret;
}

CTC_CLI(ctc_cli_monitor_set_inform_thrd,
        ctc_cli_monitor_set_inform_thrd_cmd,
        "monitor ((buffer "CTC_MONITOR_BUFFER_TYPE_ALL_STR")|(latency port GPORT_ID)) (inform-thrd MIN MAX) ",
        CTC_CLI_MONITOR_M_STR,
        "Buffer Monitor",
        CTC_MONITOR_BUFFER_TYPE_ALL_DESC,
        "Latency Monitor",
        CTC_CLI_GPORT_DESC,
        CTC_CLI_GPHYPORT_ID_DESC,
        "Inform when greater or less than threshold",
        "Min value , for buffer is buffer cell, for GG latency is thrd level<0-7>,for D2 latency is threshold time <ns>",
        "Max value , for buffer is buffer cell, for GG latency is thrd level<0-7>,for D2 latency is threshold time <ns>")
{
    int32 ret = 0;
    uint8 index = 0;
    uint32 gport = 0;
    uint32 min_value = 0;
    uint32 max_value = 0;
    uint8 sc = 0;
    uint8 level = 0;
    ctc_monitor_config_t config;
    sal_memset(&config, 0, sizeof(config));


    index = CTC_CLI_GET_ARGC_INDEX("buffer");
    if (0xFF != index)
    {
        config.monitor_type = CTC_MONITOR_BUFFER;

        ret = _ctc_cli_monitor_buffer_type_parser(vty, &config.buffer_type, &argv[0], argc);

        index = CTC_CLI_GET_ARGC_INDEX("port");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT32("gport", gport, argv[index + 1]);
            config.gport = gport;
        }

        index = CTC_CLI_GET_ARGC_INDEX("sc");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("sc", sc, argv[index + 1]);
            config.sc = sc;
        }

        index = CTC_CLI_GET_ARGC_INDEX("port-sc");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("port-sc", sc, argv[index + 1]);
            config.sc = sc;
        }

        index = CTC_CLI_GET_ARGC_INDEX("port-prio-class");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("port-prio-class", sc, argv[index + 1]);
            config.sc = sc;
            index = CTC_CLI_GET_ARGC_INDEX("prio-class-lvl");
            if (0xFF != index)
            {
                CTC_CLI_GET_UINT8("prio-class-lvl", level, argv[index + 1]);
                config.level = level;
            }
        }
    }
    else
    {
        config.monitor_type = CTC_MONITOR_LATENCY;

        index = CTC_CLI_GET_ARGC_INDEX("port");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT32("gport", gport, argv[index + 1]);
            config.gport = gport;
        }
    }

    index = CTC_CLI_GET_ARGC_INDEX("inform-thrd");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("min", min_value, argv[index + 1]);
        CTC_CLI_GET_UINT32("max", max_value, argv[index + 2]);
    }

    
    config.cfg_type = CTC_MONITOR_CONFIG_MON_INFORM_MAX;
    config.value = max_value;
    if (g_ctcs_api_en)
    {
         ret = ctcs_monitor_set_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_set_config(&config);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    config.cfg_type = CTC_MONITOR_CONFIG_MON_INFORM_MIN;
    config.value = min_value;
    if (g_ctcs_api_en)
    {
         ret = ctcs_monitor_set_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_set_config(&config);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return CLI_SUCCESS;

}

CTC_CLI(ctc_cli_monitor_get_inform_thrd,
        ctc_cli_monitor_get_inform_thrd_cmd,
        "show monitor ((buffer "CTC_MONITOR_BUFFER_TYPE_ALL_STR")|(latency port GPORT_ID)) inform",
        CTC_CLI_SHOW_STR,
        CTC_CLI_MONITOR_M_STR,
        "Buffer Monitor",
        CTC_MONITOR_BUFFER_TYPE_ALL_DESC,
        "Latency Monitor",
        CTC_CLI_GPORT_DESC,
        CTC_CLI_GPHYPORT_ID_DESC,
        "Inform and generate event")
{
    int32 ret = 0;
    uint8 index = 0;
    uint32 gport = 0;
    uint32 min_value = 0;
    uint32 max_value = 0;
    uint8 inform_en = 0;
    uint8 sc = 0;
    uint8 level = 0;
    ctc_monitor_config_t config;

    sal_memset(&config, 0, sizeof(config));

    index = CTC_CLI_GET_ARGC_INDEX("buffer");
    if (0xFF != index)
    {
        config.monitor_type = CTC_MONITOR_BUFFER;

        ret = _ctc_cli_monitor_buffer_type_parser(vty, &config.buffer_type, &argv[0], argc);

        index = CTC_CLI_GET_ARGC_INDEX("port");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT32("gport", gport, argv[index + 1]);
            config.gport = gport;
        }

        index = CTC_CLI_GET_ARGC_INDEX("sc");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("sc", sc, argv[index + 1]);
            config.sc = sc;
        }

        index = CTC_CLI_GET_ARGC_INDEX("port-sc");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("port-sc", sc, argv[index + 1]);
            config.sc = sc;
        }

        index = CTC_CLI_GET_ARGC_INDEX("port-prio-class");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("port-prio-class", sc, argv[index + 1]);
            config.sc = sc;
            index = CTC_CLI_GET_ARGC_INDEX("prio-class-lvl");
            if (0xFF != index)
            {
                CTC_CLI_GET_UINT8("prio-class-lvl", level, argv[index + 1]);
                config.level = level;
            }
        }
    }
    else
    {
        config.monitor_type = CTC_MONITOR_LATENCY;

        index = CTC_CLI_GET_ARGC_INDEX("port");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT32("gport", gport, argv[index + 1]);
            config.gport = gport;
        }
    }

    config.cfg_type = CTC_MONITOR_CONFIG_MON_INFORM_EN;
    if (g_ctcs_api_en)
    {
         ret = ctcs_monitor_get_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_get_config(&config);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    inform_en = config.value;
    ctc_cli_out("inform en  : %u \n", inform_en);


    config.cfg_type = CTC_MONITOR_CONFIG_MON_INFORM_MIN;
    if (g_ctcs_api_en)
    {
         ret = ctcs_monitor_get_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_get_config(&config);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    min_value = config.value;
    
    ctc_cli_out("inform min : %u \n", min_value);

    config.cfg_type = CTC_MONITOR_CONFIG_MON_INFORM_MAX;
    if (g_ctcs_api_en)
    {
         ret = ctcs_monitor_get_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_get_config(&config);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    max_value = config.value;

    ctc_cli_out("inform max : %u \n", max_value);
    
    return CLI_SUCCESS;

}


CTC_CLI(ctc_cli_monitor_set_latency_level_thrd,
        ctc_cli_monitor_set_latency_level_thrd_cmd,
        "monitor (latency | mburst) (level-thrd {level0 THRD0|level1 THRD1|level2 THRD2|level3 THRD3|level4 THRD4|level5 THRD5|level6 THRD6|level7 THRD7} | log-rate VALUE)",
        CTC_CLI_MONITOR_M_STR,
        "Latency monitor",
        "Micro burst",
        "Threshold zone",
        "Level 0 threshold",
        "unit:ns",
        "Level 1 threshold",
        "unit:ns",
        "Level 2 threshold",
        "unit:ns",
        "Level 3 threshold",
        "unit:ns",
        "Level 4 threshold",
        "unit:ns",
        "Level 5 threshold",
        "unit:ns",
        "Level 6 threshold",
        "unit:ns",
        "Level 7 threshold",
        "unit:ns",
        "Log rate",
        "Value")
{

    int32 ret = 0;
    uint8 level = 0;
    uint32 value = 0;
    uint8 index = 0;
    uint8 strlevel = 0;
    char  *str[8] = {"level0","level1","level2","level3","level4","level5","level6","level7"};
    ctc_monitor_glb_cfg_t config;
    sal_memset(&config, 0, sizeof(config));

    config.cfg_type = CTC_MONITOR_GLB_CONFIG_MBURST_THRD;
    index = CTC_CLI_GET_ARGC_INDEX("latency");
    if (0xFF != index)
    {
        config.cfg_type = CTC_MONITOR_GLB_CONFIG_LATENCY_THRD;
    }
    index = CTC_CLI_GET_ARGC_INDEX("level-thrd");
    if (0xFF != index)
    {
        for (level = 0; level < 8; level++)
        {
            strlevel = CTC_CLI_GET_ARGC_INDEX(str[level]);
            if(0xFF != strlevel)
            {
                CTC_CLI_GET_UINT32("thrd", value, argv[strlevel+1]);
                if(config.cfg_type == CTC_MONITOR_GLB_CONFIG_LATENCY_THRD)
                {
                    config.u.thrd.level = level;
                    config.u.thrd.threshold = value;
                }
                else
                {
                    config.u.mburst_thrd.level = level;
                    config.u.mburst_thrd.threshold = value;
                }

                if (g_ctcs_api_en)
                {
                    ret = ctcs_monitor_set_global_config(g_api_ldev, &config);
                }
                else
                {
                    ret = ctc_monitor_set_global_config(&config);
                }
                if (ret < 0)
                {
                    ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
                    return CLI_ERROR;
                }
            }
        }
    }

    index = CTC_CLI_GET_ARGC_INDEX("log-rate");
    if (0xFF != index)
    {
        if(config.cfg_type == CTC_MONITOR_GLB_CONFIG_MBURST_THRD)
        {
            config.cfg_type = CTC_MONITOR_GLB_CONFIG_MBURST_LOG_RATE;
        }
        else
        {
            config.cfg_type = CTC_MONITOR_GLB_CONFIG_LATENCY_LOG_RATE;
        }

        CTC_CLI_GET_UINT32("log-rate", config.u.value, argv[index + 1]);

        if (g_ctcs_api_en)
        {
             ret = ctcs_monitor_set_global_config(g_api_ldev, &config);
        }
        else
        {
             ret = ctc_monitor_set_global_config(&config);
        }
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    
    return CLI_SUCCESS;

}


CTC_CLI(ctc_cli_monitor_set_latency_mode,
        ctc_cli_monitor_set_latency_mode_cmd,
        "monitor latency latency-mode MODE",
        CTC_CLI_MONITOR_M_STR,
        "Latency monitor",
        "Latency monitor mode",
        "Mode")
{
    int32 ret = 0;
    uint32 value = 0;
    ctc_monitor_glb_cfg_t config;
    sal_memset(&config, 0, sizeof(config));

    config.cfg_type = CTC_MONITOR_GLB_CONFIG_LANTENCY_MODE;

    CTC_CLI_GET_UINT32("mode", value, argv[0]);
    config.u.value = value;

    if (g_ctcs_api_en)
    {
         ret = ctcs_monitor_set_global_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_set_global_config(&config);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return CLI_SUCCESS;

}

CTC_CLI(ctc_cli_monitor_set_buffer_log_mode,
        ctc_cli_monitor_set_buffer_log_mode_cmd,
        "monitor buffer (log-mode (causer|victim|all) | snapshot (enable|disable))",
        CTC_CLI_MONITOR_M_STR,
        "Buffer Monitor",
        "Buffer log mode",
        "Log packets which genrate buffer congestion",
        "Log congestion packets",
        "all",
        "snapshot snapshot",
        "Enable",
        "Disable")
{

    int32 ret = 0;
    uint8 index = 0;
    ctc_monitor_glb_cfg_t config;
    sal_memset(&config, 0, sizeof(config));

    index = CTC_CLI_GET_ARGC_INDEX("log-mode");
    if (0xFF != index)
    {
        config.cfg_type = CTC_MONITOR_GLB_CONFIG_BUFFER_LOG_MODE;
    }

    index = CTC_CLI_GET_ARGC_INDEX("causer");
    if (0xFF != index)
    {
        config.u.value = 0;
    }

    index = CTC_CLI_GET_ARGC_INDEX("victim");
    if (0xFF != index)
    {
        config.u.value = 1;
    }
    index = CTC_CLI_GET_ARGC_INDEX("all");
    if (0xFF != index)
    {
        config.u.value = 2;
    }

    index = CTC_CLI_GET_ARGC_INDEX("snapshot");
    if (0xFF != index)
    {
        config.cfg_type = CTC_MONITOR_GLB_CONFIG_BUFFER_SNAPSHOT_EN;
    }

    index = CTC_CLI_GET_ARGC_INDEX("enable");
    if (0xFF != index)
    {
        config.u.value = 1;
    }

    if (g_ctcs_api_en)
    {
         ret = ctcs_monitor_set_global_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_set_global_config(&config);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return CLI_SUCCESS;

}


CTC_CLI(ctc_cli_monitor_show_port,
        ctc_cli_monitor_show_port_cmd,
        "show monitor (port GPORT_ID | sc SC_ID | total | c2c | control) direction (ingress|egress)",
        CTC_CLI_SHOW_STR,
        CTC_CLI_MONITOR_M_STR,
        CTC_CLI_GPORT_DESC,
        CTC_CLI_GPHYPORT_ID_DESC,
        "SC",
        "SC ID",
        "Total packet",
        "C2C packet",
        "Control packet",
        "Flow direction",
        "Ingress",
        "Egress")
{
    int32 ret = CLI_SUCCESS;
    uint32 gport = 0;
    ctc_monitor_watermark_t watermark;
    ctc_monitor_config_t config;
    uint32 index = 0;
    uint32 type[5] = {CTC_MONITOR_CONFIG_MON_INFORM_EN, CTC_MONITOR_CONFIG_MON_INFORM_MIN,
                     CTC_MONITOR_CONFIG_MON_INFORM_MAX, CTC_MONITOR_CONFIG_MON_SCAN_EN,
                     CTC_MONITOR_CONFIG_LOG_EN};
    char* str[8] = {"inform en", "inform min", "inform max", "scan en", "log en","queue scan en", "sc scan en", "prio-class scan en"};
    sal_memset(&config, 0, sizeof(config));
    sal_memset(&watermark, 0, sizeof(watermark));

    ctc_cli_out("----------------------------------------\n");
    ctc_cli_out("Buffer Monitor:\n");
    ctc_cli_out("----------------------------------------\n");
    index = CTC_CLI_GET_ARGC_INDEX("ingress");
    if (0xFF != index)
    {
        config.dir = CTC_INGRESS;
    }
    else
    {
        config.dir = CTC_EGRESS;
    }
    index = CTC_CLI_GET_ARGC_INDEX("port");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("port", gport, argv[index + 1]);
        config.gport = gport;
        watermark.gport = gport;
        config.monitor_type = CTC_MONITOR_BUFFER;
        watermark.monitor_type = CTC_MONITOR_BUFFER;
        for (index = 0; index < 8; index++)
        {
            if(index == 6)
            {
                config.cfg_type = type[3];
                config.buffer_type = CTC_MONITOR_BUFFER_PORT_SC;
            }
            else if(index == 5)
            {
                config.cfg_type = type[3];
                config.buffer_type = CTC_MONITOR_BUFFER_QUEUE;
            }
            else if (index == 7)
            {
                config.cfg_type = type[3];
                config.buffer_type = CTC_MONITOR_BUFFER_PORT_PRIO_CLASS;
            }
            else
            {
                config.cfg_type = type[index];
            }
            if (g_ctcs_api_en)
            {
                 ret = ctcs_monitor_get_config(g_api_ldev, &config);
            }
            else
            {
                ret = ctc_monitor_get_config(&config);
            }
            if (ret >= 0)
            {
                ctc_cli_out("%-20s:%-10d\n", str[index], config.value);
            }
        }
        watermark.u.buffer.dir = 0;
        if (g_ctcs_api_en)
        {
             ret = ctcs_monitor_get_watermark(g_api_ldev, &watermark);
        }
        else
        {
            ret = ctc_monitor_get_watermark(&watermark);
        }
        if (ret >= 0)
        {
            ctc_cli_out("%-20s:%-10d\n", "ingress max buffer", watermark.u.buffer.max_total_cnt);
        }
        watermark.u.buffer.dir = 1;
        if (g_ctcs_api_en)
        {
             ret = ctcs_monitor_get_watermark(g_api_ldev, &watermark);
        }
        else
        {
            ret = ctc_monitor_get_watermark(&watermark);
        }
        if (ret >= 0)
        {
            ctc_cli_out("%-20s:%-10d\n", "egress max buffer", watermark.u.buffer.max_total_cnt);
        }

        ctc_cli_out("\n----------------------------------------\n");
        ctc_cli_out("Latency Monitor:\n");
        ctc_cli_out("----------------------------------------\n");
        config.monitor_type = CTC_MONITOR_LATENCY;
        config.buffer_type = 0;
        watermark.monitor_type = CTC_MONITOR_LATENCY;

        for (index = 0; index < 5; index++)
        {
            config.cfg_type = type[index];
            if (g_ctcs_api_en)
            {
                 ret = ctcs_monitor_get_config(g_api_ldev, &config);
            }
            else
            {
                ret = ctc_monitor_get_config(&config);
            }
            if (ret < 0)
            {
                ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
                return CLI_ERROR;
            }
            ctc_cli_out("%-20s :%-10u\n", str[index], config.value);
        }

        config.cfg_type = CTC_MONITOR_CONFIG_LOG_THRD_LEVEL;
        if (g_ctcs_api_en)
        {
             ret = ctcs_monitor_get_config(g_api_ldev, &config);
        }
        else
        {
            ret = ctc_monitor_get_config(&config);
        }
        if (ret < 0)
        {
            ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
        if(config.level == 0)
        {
            ctc_cli_out("%-20s :%-10d\n", "log level", config.value);
        }
        else
        {
            ctc_cli_out("%-20s :%-10d\n", "log level", config.level);
        }

        config.cfg_type = CTC_MONITOR_CONFIG_LANTENCY_DISCARD_EN;
        if (g_ctcs_api_en)
        {
             ret = ctcs_monitor_get_config(g_api_ldev, &config);
        }
        else
        {
            ret = ctc_monitor_get_config(&config);
        }
        if (ret >= 0)
        {
            ctc_cli_out("%-20s :%-10d\n", "discard en", config.value);
        }

        config.cfg_type = CTC_MONITOR_CONFIG_LANTENCY_DISCARD_THRD_LEVEL;
        if (g_ctcs_api_en)
        {
             ret = ctcs_monitor_get_config(g_api_ldev, &config);
        }
        else
        {
            ret = ctc_monitor_get_config(&config);
        }
        if (ret >= 0)
        {
            ctc_cli_out("%-20s :%-10d\n", "discard level", config.level);
        }
        config.cfg_type = CTC_MONITOR_CONFIG_LANTENCY_ECN_EN;
        if (g_ctcs_api_en)
        {
             ret = ctcs_monitor_get_config(g_api_ldev, &config);
        }
        else
        {
            ret = ctc_monitor_get_config(&config);
        }
        if (ret >= 0)
        {
            ctc_cli_out("%-20s :%-10d\n", "ecn-mark en", config.value);
        }

        config.cfg_type = CTC_MONITOR_CONFIG_LANTENCY_ECN_THRD_LEVEL;
        if (g_ctcs_api_en)
        {
             ret = ctcs_monitor_get_config(g_api_ldev, &config);
        }
        else
        {
            ret = ctc_monitor_get_config(&config);
        }
        if (ret >= 0)
        {
            ctc_cli_out("%-20s :%-10d\n", "ecn-mark level", config.level);
        }
        if (g_ctcs_api_en)
        {
             ret = ctcs_monitor_get_watermark(g_api_ldev, &watermark);
        }
        else
        {
            ret = ctc_monitor_get_watermark(&watermark);
        }
        if (ret < 0)
        {
            ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
        ctc_cli_out("%-20s :%-10"PRIu64"\n", "max latency", watermark.u.latency.max_latency);
        ctc_cli_out("%-20s :%-10"PRIu64"\n", "min latency", watermark.u.latency.min_latency);
    }

    index = CTC_CLI_GET_ARGC_INDEX("total");
    if (0xFF != index)
    {
        config.buffer_type = CTC_MONITOR_BUFFER_TOTAL;
        config.monitor_type = CTC_MONITOR_BUFFER;
        for (index = 0; index < 4; index++)
        {
            config.cfg_type = type[index];
            if (g_ctcs_api_en)
            {
                 ret = ctcs_monitor_get_config(g_api_ldev, &config);
            }
            else
            {
                ret = ctc_monitor_get_config(&config);
            }
            if (ret < 0)
            {
                ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
                return CLI_ERROR;
            }
            ctc_cli_out("%-20s:%-10d\n", str[index], config.value);
        }
    }

    index = CTC_CLI_GET_ARGC_INDEX("c2c");
    if (0xFF != index)
    {
        config.buffer_type = CTC_MONITOR_BUFFER_C2C;
        config.monitor_type = CTC_MONITOR_BUFFER;
        for (index = 0; index < 4; index++)
        {
            config.cfg_type = type[index];
            if (g_ctcs_api_en)
            {
                 ret = ctcs_monitor_get_config(g_api_ldev, &config);
            }
            else
            {
                ret = ctc_monitor_get_config(&config);
            }
            if (ret < 0)
            {
                ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
                return CLI_ERROR;
            }
            ctc_cli_out("%-20s:%-10d\n", str[index], config.value);
        }
    }

    index = CTC_CLI_GET_ARGC_INDEX("control");
    if (0xFF != index)
    {
        config.buffer_type = CTC_MONITOR_BUFFER_CONTROL;
        config.monitor_type = CTC_MONITOR_BUFFER;
        for (index = 0; index < 4; index++)
        {
            config.cfg_type = type[index];
            if (g_ctcs_api_en)
            {
                 ret = ctcs_monitor_get_config(g_api_ldev, &config);
            }
            else
            {
                ret = ctc_monitor_get_config(&config);
            }
            if (ret < 0)
            {
                ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
                return CLI_ERROR;
            }
            ctc_cli_out("%-20s:%-10d\n", str[index], config.value);
        }
    }
    
    index = CTC_CLI_GET_ARGC_INDEX("sc");
    if (0xFF != index)
    {
        config.buffer_type = CTC_MONITOR_BUFFER_SC;
        CTC_CLI_GET_UINT32("sc id", config.sc, argv[index + 1]);
        config.monitor_type = CTC_MONITOR_BUFFER;
        for (index = 0; index < 4; index++)
        {
            config.cfg_type = type[index];
            if (g_ctcs_api_en)
            {
                 ret = ctcs_monitor_get_config(g_api_ldev, &config);
            }
            else
            {
                ret = ctc_monitor_get_config(&config);
            }
            if (ret < 0)
            {
                ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
                return CLI_ERROR;
            }
            ctc_cli_out("%-20s:%-10d\n", str[index], config.value);
        }
    }
    return CLI_SUCCESS;

}

CTC_CLI(ctc_cli_monitor_show_path,
        ctc_cli_monitor_show_path_cmd,
        "show monitor latency path-port (src-port SRC_GPORT) (dst-port DST_GPORT)",
        CTC_CLI_SHOW_STR,
        CTC_CLI_MONITOR_M_STR,
        "Latency Monitor",
        "monitor port path",
        "source global port",
        CTC_CLI_GPHYPORT_ID_DESC,
        "Destination global port",
        CTC_CLI_GPHYPORT_ID_DESC)
{
    int32 ret = CLI_SUCCESS;
    uint32 gport = 0;
    uint8 index = 0;
    ctc_monitor_config_t config;
    sal_memset(&config, 0, sizeof(config));

    config.monitor_type = CTC_MONITOR_LATENCY;
    config.cfg_type = CTC_MONITOR_CONFIG_PATH_LANTENCY_EN;

    index = CTC_CLI_GET_ARGC_INDEX("src-port");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("src gport", gport, argv[index + 1]);
        config.src_gport = gport;
    }

    index = CTC_CLI_GET_ARGC_INDEX("dst-port");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("dst gport", gport, argv[index + 1]);
        config.gport = gport;
    }

    if (g_ctcs_api_en)
    {
         ret = ctcs_monitor_get_config(g_api_ldev, &config);
    }
    else
    {
        ret = ctc_monitor_get_config(&config);
    }
    if (ret >= 0)
    {
        ctc_cli_out("%-20s :%-10d\n", "path port en", config.value);
    }

    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_monitor_set_snapshot_thrd,
        ctc_cli_monitor_set_snapshot_thrd_cmd,
        "monitor buffer snapshot-thrd ("CTC_MONITOR_BUFFER_GLOBAL_TYPE_STR") "CTC_CLI_DIR_STR" (threhold THRD)",
        CTC_CLI_MONITOR_M_STR,
        "Buffer Monitor",
        "Snapshot threshold",
        CTC_MONITOR_BUFFER_GLOBAL_TYPE_DESC,
        CTC_CLI_DIR_DESC,
        "Threshold",
        "Threshold value"
        )
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0;
    ctc_monitor_buffer_snapshot_t snapshot;
    sal_memset(&snapshot, 0, sizeof(snapshot));

    ret = _ctc_cli_monitor_buffer_type_parser(vty, &snapshot.buffer_type, argv, argc);
    CTC_CLI_DIR_SET(&snapshot.dir);
    
    index = CTC_CLI_GET_ARGC_INDEX("sc");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("sc-id", snapshot.sc, argv[index + 1]);
    }
    
    index = CTC_CLI_GET_ARGC_INDEX("threhold");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("snapshot-thrd", snapshot.threshold, argv[index + 1]);
    }

    if (g_ctcs_api_en)
    {
        ret = ctcs_monitor_set_config2(g_api_ldev, CTC_MONITOR_CONFIG_BUFFER_SNAPSHOT_THRD, &snapshot);
    }
    else
    {
        ret = ctc_monitor_set_config2(CTC_MONITOR_CONFIG_BUFFER_SNAPSHOT_THRD, &snapshot);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return CLI_SUCCESS;
}
CTC_CLI(ctc_cli_monitor_get_snapshot_thrd,
        ctc_cli_monitor_get_snapshot_thrd_cmd,
        "show monitor buffer snapshot-thrd ("CTC_MONITOR_BUFFER_GLOBAL_TYPE_STR") "CTC_CLI_DIR_STR" ",
        CTC_CLI_SHOW_STR,
        CTC_CLI_MONITOR_M_STR,
        "Buffer Monitor",
        "Snapshot threshold",
        CTC_MONITOR_BUFFER_GLOBAL_TYPE_DESC,
        CTC_CLI_DIR_DESC)
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0;
    ctc_monitor_buffer_snapshot_t snapshot;
    sal_memset(&snapshot, 0, sizeof(snapshot));

    ret = _ctc_cli_monitor_buffer_type_parser(vty, &snapshot.buffer_type, argv, argc);
    CTC_CLI_DIR_SET(&snapshot.dir);

    index = CTC_CLI_GET_ARGC_INDEX("sc");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("sc-id", snapshot.sc, argv[index + 1]);
    }

    if (g_ctcs_api_en)
    {
         ret = ctcs_monitor_get_config2(g_api_ldev, CTC_MONITOR_CONFIG_BUFFER_SNAPSHOT_THRD, &snapshot);
    }
    else
    {
        ret = ctc_monitor_get_config2(CTC_MONITOR_CONFIG_BUFFER_SNAPSHOT_THRD, &snapshot);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    ctc_cli_out("snapshot-thrd:%u \n", snapshot.threshold);

    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_monitor_set_ecn_thrd,
        ctc_cli_monitor_set_ecn_thrd_cmd,
        "monitor latency port GPORT ecn-thrd level LVL {on-thrd ON|off-thrd OFF|}",
        CTC_CLI_MONITOR_M_STR,
        "Latency Monitor",
        CTC_CLI_GPORT_DESC,
        CTC_CLI_GPHYPORT_ID_DESC,
        "ECN Threshold",
        "Threshold Level",
        "Level",
        "Trigger mark ecn latency threshold",
        "Value",
        "Resume mark ecn latency threshold",
        "Value")
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0;
    ctc_monitor_latency_ecn_thrd_t latency_ecn;

    sal_memset(&latency_ecn, 0, sizeof(ctc_monitor_latency_ecn_thrd_t));
    CTC_CLI_GET_UINT32("gport", latency_ecn.gport, argv[0]);
    CTC_CLI_GET_UINT8("level", latency_ecn.level, argv[1]);
    index = CTC_CLI_GET_ARGC_INDEX("on-thrd");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("on-thrd", latency_ecn.on_thrd, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("off-thrd");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("off-thrd", latency_ecn.off_thrd, argv[index + 1]);
    }

    if (g_ctcs_api_en)
    {
         ret = ctcs_monitor_set_config2(g_api_ldev, CTC_MONITOR_CONFIG_LATENCY_ECN_THRD, &latency_ecn);
    }
    else
    {
        ret = ctc_monitor_set_config2(CTC_MONITOR_CONFIG_LATENCY_ECN_THRD, &latency_ecn);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_monitor_get_ecn_thrd,
        ctc_cli_monitor_get_ecn_thrd_cmd,
        "show monitor latency port GPORT ecn-thrd level LVL ",
        CTC_CLI_SHOW_STR,
        CTC_CLI_MONITOR_M_STR,
        "Latency Monitor",
        CTC_CLI_GPORT_DESC,
        CTC_CLI_GPHYPORT_ID_DESC,
        "ECN Threshold",
        "Threshold Level",
        "Level")
{
    int32 ret = CLI_SUCCESS;
    ctc_monitor_latency_ecn_thrd_t latency_ecn;

    sal_memset(&latency_ecn, 0, sizeof(ctc_monitor_latency_ecn_thrd_t));
    CTC_CLI_GET_UINT32("gport", latency_ecn.gport, argv[0]);
    CTC_CLI_GET_UINT8("level", latency_ecn.level, argv[1]);

    if (g_ctcs_api_en)
    {
         ret = ctcs_monitor_get_config2(g_api_ldev, CTC_MONITOR_CONFIG_LATENCY_ECN_THRD, &latency_ecn);
    }
    else
    {
        ret = ctc_monitor_get_config2(CTC_MONITOR_CONFIG_LATENCY_ECN_THRD, &latency_ecn);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    ctc_cli_out("on-thrd : %u \n", latency_ecn.on_thrd);
    ctc_cli_out("off-thrd: %u \n", latency_ecn.off_thrd);
    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_monitor_set_ecn_priority_map,
        ctc_cli_monitor_set_ecn_priority_map_cmd,
        "monitor latency ecn-prio-map priority PRIO level LVL",
        CTC_CLI_MONITOR_M_STR,
        "Latency Monitor",
        "ECN Priority Map",
        "Priority",
        "Priority Value",
        "Level",
        "Level value")
{
    int32 ret = CLI_SUCCESS;
    ctc_monitor_latency_ecn_prio_map_t latency_ecn_map;

    sal_memset(&latency_ecn_map, 0, sizeof(ctc_monitor_latency_ecn_prio_map_t));
    CTC_CLI_GET_UINT8("priority", latency_ecn_map.priority, argv[0]);
    CTC_CLI_GET_UINT8("level", latency_ecn_map.level, argv[1]);

    if (g_ctcs_api_en)
    {
         ret = ctcs_monitor_set_config2(g_api_ldev, CTC_MONITOR_CONFIG_LATENCY_ECN_PRIO_MAP, &latency_ecn_map);
    }
    else
    {
        ret = ctc_monitor_set_config2(CTC_MONITOR_CONFIG_LATENCY_ECN_PRIO_MAP, &latency_ecn_map);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    return CLI_SUCCESS;
}
CTC_CLI(ctc_cli_monitor_get_ecn_priority_map,
        ctc_cli_monitor_get_ecn_priority_map_cmd,
        "show monitor latency ecn-prio-map",
        CTC_CLI_SHOW_STR,
        CTC_CLI_MONITOR_M_STR,
        "Latency Monitor",
        "ECN Priority Map")
{
    int32 ret = CLI_SUCCESS;
    uint8 prio = 0;
    ctc_monitor_latency_ecn_prio_map_t latency_ecn_map;

    sal_memset(&latency_ecn_map, 0, sizeof(ctc_monitor_latency_ecn_prio_map_t));
    ctc_cli_out("%-10s %-5s\n", "priority", "level");
    ctc_cli_out("--------------------\n");
    for (prio = 0; prio < 16; prio++)
    {
        latency_ecn_map.priority = prio;
        if (g_ctcs_api_en)
        {
            ret = ctcs_monitor_get_config2(g_api_ldev, CTC_MONITOR_CONFIG_LATENCY_ECN_PRIO_MAP, &latency_ecn_map);
        }
        else
        {
            ret = ctc_monitor_get_config2(CTC_MONITOR_CONFIG_LATENCY_ECN_PRIO_MAP, &latency_ecn_map);
        }
        if (ret < 0)
        {
            ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }

        ctc_cli_out("%-10u %-5u\n", prio, latency_ecn_map.level);
    }
    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_monitor_debug_on,
        ctc_cli_monitor_debug_on_cmd,
        "debug monitor (ctc|sys) (debug-level {func|param|info|error|export} |) (log LOG_FILE |)",
        CTC_CLI_DEBUG_STR,
        "Monitor module",
        "CTC layer",
        "Sys layer",
        CTC_CLI_DEBUG_LEVEL_STR,
        CTC_CLI_DEBUG_LEVEL_FUNC,
        CTC_CLI_DEBUG_LEVEL_PARAM,
        CTC_CLI_DEBUG_LEVEL_INFO,
        CTC_CLI_DEBUG_LEVEL_ERROR,
        CTC_CLI_DEBUG_LEVEL_EXPORT,
        CTC_CLI_DEBUG_MODE_LOG,
        CTC_CLI_LOG_FILE)
{

    uint32 typeenum = 0;
    uint8 level = CTC_DEBUG_LEVEL_INFO | CTC_DEBUG_LEVEL_FUNC | CTC_DEBUG_LEVEL_PARAM | CTC_DEBUG_LEVEL_ERROR | CTC_DEBUG_LEVEL_EXPORT;
    uint8 index = 0;
    char file[MAX_FILE_NAME_SIZE];

    index = CTC_CLI_GET_ARGC_INDEX("debug-level");
    if (index != 0xFF)
    {
        level = CTC_DEBUG_LEVEL_NONE;
        index = CTC_CLI_GET_ARGC_INDEX("func");
        if (index != 0xFF)
        {
            level |= CTC_DEBUG_LEVEL_FUNC;
        }

        index = CTC_CLI_GET_ARGC_INDEX("param");
        if (index != 0xFF)
        {
            level |= CTC_DEBUG_LEVEL_PARAM;
        }

        index = CTC_CLI_GET_ARGC_INDEX("info");
        if (index != 0xFF)
        {
            level |= CTC_DEBUG_LEVEL_INFO;
        }

        index = CTC_CLI_GET_ARGC_INDEX("error");
        if (index != 0xFF)
        {
            level |= CTC_DEBUG_LEVEL_ERROR;
        }

        index = CTC_CLI_GET_ARGC_INDEX("export");
        if (index != 0xFF)
        {
            level |= CTC_DEBUG_LEVEL_EXPORT;
        }

    }

    index = CTC_CLI_GET_ARGC_INDEX("log");
    if (index != 0xFF)
    {
      if (sal_strlen(argv[index + 1]) >(MAX_FILE_NAME_SIZE) )
        {
             ctc_cli_out("ERROR: File name is too long!\n\n");
             return CLI_ERROR;
        }
        sal_strcpy((char*)&file, argv[index + 1]);
        level |= CTC_DEBUG_LEVEL_LOGFILE;
        ctc_debug_set_log_file("monitor", "monitor", (void*)&file, 1);
    }

    if (0 == sal_memcmp(argv[0], "ctc", 3))
    {
        typeenum = MONITOR_CTC;
    }
    else
    {
        typeenum = MONITOR_SYS;

    }

    ctc_debug_set_flag("monitor", "monitor", typeenum, level, TRUE);
    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_monitor_debug_off,
        ctc_cli_monitor_debug_off_cmd,
        "no debug monitor (ctc | sys)",
        CTC_CLI_NO_STR,
        CTC_CLI_DEBUG_STR,
        "Monitor Module",
        "Ctc layer",
        "Sys layer")
{
    uint32 typeenum = 0;
    uint8 level = 0;

    if (0 == sal_memcmp(argv[0], "ctc", 3))
    {
        typeenum = MONITOR_CTC;
    }
    else if (0 == sal_memcmp(argv[0], "sys", 3))
    {
        typeenum = MONITOR_SYS;
    }

    ctc_debug_set_flag("monitor", "monitor", typeenum, level, FALSE);

    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_monitor_show_debug,
        ctc_cli_monitor_show_debug_cmd,
        "show debug monitor (ctc | sys)",
        CTC_CLI_SHOW_STR,
        CTC_CLI_DEBUG_STR,
        "Monitor Module",
        "Ctc layer",
        "Sys layer")
{
    uint32 typeenum = 0;
    uint8 level = 0;
    uint8 en = 0;

    if (0 == sal_memcmp(argv[0], "ctc", 3))
    {
        typeenum = MONITOR_CTC;
    }
    else if (0 == sal_memcmp(argv[0], "sys", 3))
    {
        typeenum = MONITOR_SYS;
    }
    en = ctc_debug_get_flag("monitor", "monitor", typeenum, &level);
    ctc_cli_out("Monitor:%s debug %s level:%s\n", argv[0],
                en ? "on" : "off",
                ctc_cli_get_debug_desc(level));

    return CLI_SUCCESS;
}

int32
ctc_monitor_cli_init(void)
{
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_set_monitor_buffer_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_set_buffer_scan_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_set_monitor_latency_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_set_timer_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_get_timer_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_op_watermark_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_queue_watermark_en_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_show_queue_watermark_en_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_queue_watermark_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_set_inform_thrd_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_get_inform_thrd_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_set_latency_level_thrd_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_set_latency_mode_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_set_buffer_log_mode_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_show_debug_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_debug_off_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_debug_on_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_show_port_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_show_path_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_set_snapshot_thrd_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_get_snapshot_thrd_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_set_ecn_thrd_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_get_ecn_thrd_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_set_ecn_priority_map_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_monitor_get_ecn_priority_map_cmd);

    return CLI_SUCCESS;
}
#endif

